package io.xxx.omni.mdc.site.web

import io.xxx.omni.mdc.model.Store
import io.xxx.omni.mdc.site.service.StoreService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/stores")
class StoreController {

    @Autowired
    private lateinit var storeService: StoreService

    @GetMapping
    fun getAll(@RequestParam pid: String?, @RequestParam enabled: Boolean?): List<Store> {
        return storeService.getAll(pid, enabled)
    }

    @GetMapping("/{id}")
    fun getOne(@PathVariable id: String): Store? {
        return storeService.getOne(id)
    }
}